#include<bits/stdc++.h>

using namespace std;
const int maxn = 1e3 + 10;
int n;
int a[maxn];
int q, x, y, z;

int main() {
    cin >> n;
    for (int i = 1; i <= n; i++) {
        cin >> a[i];
    }
    cin >> q;
    while (q--) {
        cin >> x >> y >> z;
        x++;
        y++;
        cout << count(a + x, a + y, z) << endl;

    }
    return 0;
}